from allpairspy import AllPairs

from api_py.enums.cookie import Cookie
from api_py.generate_case.template import template_case
from api_py.utils.file_sys import write_json

ids = [
    {"value": "ff80818184524b500184be3a7dbe03a9", "description": "存在的id"},
    {"value": "not_exist", "description": "不存在的id"},
]

cookies = [
    {"value": Cookie.ADMIN_COOKIE.value, "description": "管理员登录"},
    {"value": Cookie.SUPERVISOR_COOKIE.value, "description": "督导登录"},
    {"value": Cookie.COUNSELOR_COOKIE.value, "description": "咨询师登录"},
    {"value": Cookie.WEIXIN_COOKIE.value, "description": "微信访客登录"},
    {"value": Cookie.NULL_COOKIE.value, "description": "未登录"},
    {"value": Cookie.ERROR_COOKIE.value, "description": "其他Cookie"},
]

def case16_user_list(api_type):
    json_result = {}

    i = 0
    for id in ids:
        for cookie in cookies:
            case = template_case()
            request = case["request"]
            # 设置url参数
            request["params"]["userId"] = id
            # 设置请求体cookie
            request["headers"]["Cookie"] = cookie

            json_result[i] = case
            i += 1


    write_json(api_type.value[0]["file_name"], json_result)
